﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TenderSampleApp.Models;
using TenderSampleApp.Code;
using System.IO;
using System.Web.Hosting;
using System.Collections;
using TenderSampleApp.Models.Profile;
using System.Web.Security;
using System.Web.Profile;
using System.Data;

namespace TenderSampleApp.Controllers
{

    [ActionFilterSystem]
    public class HomeController : Controller
    {
        DAL dl = new DAL();
        [Authorize(Roles = "USER")]
        public ActionResult Index()
        {
            ProfileBase profile = ProfileBase.Create(User.Identity.Name);
            if (String.IsNullOrEmpty(profile.GetPropertyValue("typeOfPerson").ToString()))
                return RedirectToAction("FillUserProfile","Profile",null);

            VATListModel listVatModel = dl.GetVatsOfCurrentAuction();
            return View(listVatModel);
        }

        public ActionResult LogOnOrReister()
        {


            return View();
        }





        public ActionResult GetReport(int id)
        {
            ReportModel rp = new ReportModel();

            rp.Title = "Отчет покупателях текущих тендеров";


            return View(rp);
        }

        //public ActionResult GetCurrentResult(int id)
        //{
        //    List<TenderResultModel> listTrm = dl.GetTenderResult(id);
        //    ViewBag.FirmName = listTrm[0].FirmName;
        //    return View(listTrm);
        //}
        [HttpGet]
        public ActionResult EditCurrentResult(TenderResultModel tr)
        {
            return View(tr);
        }
        [Authorize(Roles = "USER")]
        public ActionResult About()
        {
            return View();
        }
    }
}
